#!/bin/bash
### BEGIN INIT INFO
# Provides: wsmCleanup
# Required-Start: $local_fs
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Provide WebSM cleanup
# Description: Cleanup websm server instances
### END INIT INFO


case "$1" in
 start)
	touch /var/lock/subsys/wsmCleanup
        ;;
 stop)
        echo "Stopping all WServer processes"
	if [[ `ps -efww | grep -i wserver | grep java` != "" ]] ; then
        	ps -efww | grep -i wserver | grep java | awk '{print $2}' | xargs kill -15
	fi
        ;;
 *)
        echo "Usage: wsmCleanup {start|stop}"
        exit 1
        ;;
esac
exit 0
